home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
VIC20
/
E-Education
/
(v)e3.d64
/
vic pilot 3k.v
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-17
|
3KB
|
113 lines
1 GOTO10:REM **PILOT**
2 I$=""
3 SYS820:IFPEEK(0)=13THENRETURN
4 I$=I$+CHR$(PEEK(0)):GOTO3
10 CLR:M=200:X=0:Y=0:A=0:P=0:Z=0:I$="":DIMS%(9),N%(26),S$(26),L$(M),C$(15):F%=0
20 PRINT"[147] **** PILOT V2.1 ****":FORX=820TO825:READZ:POKEX,Z:NEXT:FORX=0TO15
25 READC$(X):NEXT:DATA32,207,255,133,0,96
30 DATALIST,RUN,SAVE,LOAD,NEW,BASIC,PLIST,T,J,E,U,M,C,A,I,H
40 PRINT"PILOT."
50 GOSUB2:PRINT:IFASC(I$)=32ANDLEN(I$)=1THEN50
60 IFLEFT$(I$,1)=" "THENI$=MID$(I$,2):GOTO60
70 L=VAL(I$):IFL<>0THEN200
80 L=1:H=M:R$="":FORX=1TOLEN(I$):IFMID$(I$,X,1)<>" "THENNEXTX:GOTO140
90 R$=MID$(I$,X+1):I$=LEFT$(I$,X-1)
100 L=VAL(R$):H=L:FORX=1TOLEN(R$):IFMID$(R$,X,1)<>"-"THENNEXT:GOTO120
110 L=VAL(LEFT$(R$,X-1)):H=VAL(MID$(R$,X+1))
120 IFL=0THENL=1
130 IFH=0THENH=M
140 FORX=0TO6:IFI$<>LEFT$(C$(X),LEN(I$))THENNEXT:PRINT"UNKNOWN COMMAND":GOTO40
150 ONX+1GOTO400,1000,500,600,700,800,390
200 IFL>MTHENPRINT"LINE NUMBER OUT OF RANGE":GOTO40
210 X=LEN(STR$(L)):X$=MID$(I$,X):IFX$=""THENL$(L)="":GOTO50
220 IFLEFT$(X$,1)=" "THENX$=MID$(X$,2):GOTO220
230 X=3:IFMID$(X$,2,1)<>":"THENX=4:IFMID$(X$,3,1)<>":"THENL$(L)=X$:GOTO50
240 FORZ=7TO15:IFLEFT$(X$,1)<>C$(Z)THENNEXT:PRINT"ILLEGAL COMMAND":GOTO40
250 IFMID$(X$,2,1)="Y"THENZ=Z+10
260 IFMID$(X$,2,1)="N"THENZ=Z+20
270 L$(L)=CHR$(Z-6)+MID$(X$,X):GOTO50
390 OPEN1,4:GOTO410
400 OPEN1,3
410 FORX=LTOH:IFL$(X)=""THEN450
420 X$=":":Z=ASC(L$(X)):IFZ>30THENX$=LEFT$(L$(X),1):GOTO440
425 IFZ>20THENZ=Z-20:X$="N"+X$
430 IFZ>10THENZ=Z-10:X$="Y"+X$
435 X$=C$(Z+6)+X$
440 PRINT#1,X;X$;MID$(L$(X),2)
450 GETX$:IFX$<>""THENCLOSE1:GOTO40
460 NEXT:CLOSE1:GOTO40
500 OPEN1,8,2,R$+",S,W":PRINT"SAVING "R$
510 FORX=1TOM:IFL$(X)=""THEN530
520 PRINT#1,X;CHR$(13)CHR$(34)L$(X)CHR$(34)CHR$(13);
530 NEXTX:CLOSE1:GOTO40
600 OPEN1,8,2,R$+",S,R":PRINT"LOADING "R$
610 INPUT#1,X:IFSTGOTO630
620 INPUT#1,L$(X):IFST=0THEN610
630 CLOSE1:GOTO40
700 GOTO10
800 PRINT"EXITING TO BASIC":END
1000 L=0:FORX=1TO25:N%(X)=0:S$(X)="":NEXT:P=0:F%=0
1010 L=L+1:IFL>=MORL$(L)="END"THEN40
1011 GETX$:IFX$="@"THEN40
1015 IFL$(L)=""THEN1010
1020 X=ASC(L$(L)):IFX>40THEN1010
1030 IFX>20THENX=X-20:IFF%=1THEN1010
1040 IFX>10THENX=X-10:IFF%=0THEN1010
1050 C$=MID$(L$(L),2):ONXGOTO1100,1220,1300,1200,1500,1600,1700,1800,1900
1090 PRINT"ERROR #"E"IN LINE"L:GOTO40
1100 Z=0:IFRIGHT$(C$,1)=";"THENZ=1:C$=LEFT$(C$,LEN(C$)-1)
1105 FORX=1TOLEN(C$):X$=MID$(C$,X,1):IFX$="#"THEN1150
1110 IFX$="$"THEN1160
1120 PRINTX$;:NEXT:IFZ=0THENPRINT
1130 GOTO1010
1150 GOSUB1190:X$=STR$(N%(Y)):GOTO1120
1160 GOSUB1190:X$=S$(Y):GOTO1120
1190 X=X+1:Y=ASC(MID$(C$,X,1))-64:IFY<1ORY>26THENE=1:GOTO1090
1195 RETURN
1200 IFP>8THENE=3:GOTO1090
1210 P=P+1:S%(P)=L
1220 IFVAL(C$)<>0THENL=VAL(C$)-1:GOTO1010
1230 FORX=1TOM:IFC$<>L$(X)THENNEXT:E=2:GOTO1090
1240 L=X:GOTO1010
1300 IFP=0THENE=4:GOTO1090
1310 L=S%(P):P=P-1:GOTO1010
1500 X=1:C$=C$+",":X$=AC$:IFLEFT$(C$,1)="$"THENGOSUB1590
1510 FORZ=XTOLEN(C$):IFMID$(C$,Z,1)<>","THENNEXT
1520 Z$=MID$(C$,X,Z-X):FORY=1TOLEN(X$):IFMID$(X$,Y,LEN(Z$))=Z$THENF%=1:GOTO1010
1560 NEXT:IFZ<LEN(C$)THENX=Z+1:GOTO1510
1570 F%=0:GOTO1010
1590 Y=ASC(MID$(C$,2))-64:IFY<1ORY>26THENE=1:GOTO1090
1595 X$=S$(Y):X=4:RETURN
1600 A=3:Z=0:X$="":IFLEFT$(C$,1)<>"#"ORMID$(C$,3,1)<>"="THENE=5:GOTO1090
1610 Y=1:X$=MID$(C$,A,1):A=A+1:IFMID$(C$,A,1)="-"THENA=A+1:Y=-1
1620 IFMID$(C$,A,1)<>"#"THENY=Y*VAL(MID$(C$,A)):A=A+LEN(STR$(Y))-1:GOTO1650
1630 X=ASC(MID$(C$,A+1))-64:IFX<1ORX>26THENE=1:GOTO1090
1635 IFX=18THENY=Y*RND(1):GOTO1650
1640 Y=Y*N%(X):A=A+2
1650 IFX$="="THENZ=Y
1655 IFX$="-"THENZ=Z-Y
1660 IFX$="+"THENZ=Z+Y
1665 IFX$="/"ANDY=0THENE=6:GOTO1090
1670 IFX$="*"THENZ=Z*Y
1675 IFX$="/"THENZ=Z/Y
1680 IFA<=LEN(C$)THEN1610
1685 Y=N%(X1):IFX-4>0THENIFMID$(C$,X-4)="-"ANDX-4<>ATHENZ=-Z
1690 X=ASC(MID$(C$,2))-64:IFX<1ORX>26THENE=1:GOTO1090
1692 IFZ>32767ORZ<-32767THENE=7:GOTO1090
1695 N%(X)=Z:GOTO1010
1700 IFC$=""THENGOSUB2:AC$=I$:PRINT:GOTO1010
1720 X=ASC(MID$(C$,2))-64:IFX<1ORX>26THENE=1:GOTO1090
1730 GOSUB2:Z=VAL(I$):PRINT:IFLEFT$(C$,1)="#"THENN%(X)=Z
1740 IFLEFT$(C$,1)="$"THENS$(X)=I$
1750 GOTO1010
1800 IFLEFT$(C$,1)<>"#"THENE=5:GOTO1090
1810 X=ASC(MID$(C$,2))-64:IFX<1ORX>26THENE=1:GOTO1090
1820 A=N%(X):X$=MID$(C$,3,1):IFMID$(C$,4,1)<>"#"THENX=VAL(MID$(C$,4)):GOTO1840
1830 X=ASC(MID$(C$,5))-64:IFX<1ORX>26THENE=1:GOTO1090
1835 X=N%(X)
1840 F%=0:IFX$="<"ANDA<XTHENF%=1
1850 IFX$=">"ANDA>XTHENF%=1
1860 IFX$="="ANDA=XTHENF%=1
1870 GOTO1010
1900 PRINT"[147]";:GOTO1010